package com.leen.util;

import com.leen.vo.LoginUserVO;

/**
 * 当前用户
 * @author wy
 */
public class ThreadLocalUser {

    private   ThreadLocal<LoginUserVO> userVOThreadLocal=new ThreadLocal<>();

    private static ThreadLocalUser  insance=new ThreadLocalUser();

    public static ThreadLocalUser  getInstance(){
        return insance;
    }

    private ThreadLocalUser(){
    }

    /**
     * 设定当前线程用户
     * @param loginUserVO
     */
    public void setCurrentUser(LoginUserVO loginUserVO){
        userVOThreadLocal.set(loginUserVO);
    }
    /**
     * 得到当前登录的用户
     * @return
     */
    public   LoginUserVO getCurrentUser(){
        return new LoginUserVO();
    }

    /**
     * 移出用户
     */
    public void removeTeacherVO(){
        this.userVOThreadLocal.remove();
    }


    /**
     * 当前用户的编号
     * @return
     */
    public   int getCurrentUserId(){
        return 1;
    }
    /**
     * 当前用户的名称
     * @return
     */
    public   String getCurrentUserName(){
        return "admin";
    }



}
